package com.googlecode.dgwt.client.dijit.view.store;

import com.googlecode.dgwt.client.dojo.data.base.ModeledStore;
import com.googlecode.dgwt.client.dojo.data.base.Store;
import com.googlecode.dgwt.client.dojo.data.listener.ModelListener;
import com.googlecode.dgwt.client.dojo.data.model.StoreColumn;
import com.googlecode.dgwt.client.dojo.exception.AttachException;

/**
 * Base class for views that creates header columns from a {@link ModeledStore}
 * definition.
 * 
 * @author wellsantos@wellsantos.com
 * @since 0.01
 */
public abstract class HeaderViewBase extends StoreViewBase implements ModelListener<Object> {

    protected HeaderViewBase(boolean ready) {
        super(ready);
    }

    @Override
    public ModeledStore<Object> getStore(){
        return (ModeledStore<Object>) super.getStore();
    }

    @Override
    public void doAttach(Store<Object> parent) throws AttachException {
        if (!(parent instanceof ModeledStore<?>)){
            throw new AttachException(this, "the attached store should be a ModeledStore descendant");
        }
        super.doAttach(parent);
    }


    // Implements ModelListener
    
    
    @Override
    public void onColumnAdded(StoreColumn<Object, ?> column) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void onColumnChanged(StoreColumn<Object, ?> column) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void onColumnRemoved(StoreColumn<Object, ?> column) {
        // TODO Auto-generated method stub
        
    }

    @Override
    public void onColumnReplaced(int columnIndex, StoreColumn<Object, ?> oldColumn, StoreColumn<Object, ?> newColumn) {
        // TODO Auto-generated method stub
        
    }


    // TODO: Event Handlers
    
}
